package com.scommunity.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.scommunity.admin.vo.BuildingQO;
import com.scommunity.domain.Building;
import org.apache.ibatis.annotations.*;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Mapper
@Transactional(rollbackFor = Exception.class)
public interface BuildingMapper extends BaseMapper<Building> {
    List<Building> findPageInfoByCondition(BuildingQO buildingQO);

    @Select("select * from sc_building")
    List<Building> findAll();

    @Select("select * from sc_building where building_status = 1")
    List<Building> getAllByStatus();

    @Insert("insert into sc_building values(#{buildingId},#{buildingName},#{buildingUnit},0)")
    void add(Building building);

    void update1(Building building);

    @Delete("delete from sc_building where building_id = #{id}")
    void del(String id);

    @Select("select building_status from sc_building where building_id = #{id}")
    int getStatuseById(String id);

}
